home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shw_maindoors.cog < prev    next >
Text File  |  1999-11-15  |  9KB  |  328 lines

  1. # Jones 3D Cog Script
  2. #
  3. # shw_entrance_doors.cog
  4. #
  5. # Main Waterworks Door Script
  6. #
  7. # [CMG]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.     
  14.     #        MESSAGES
  15.     message    startup        
  16.     message    activated    
  17.     message    blocked        
  18.  
  19.     #    ACTORS
  20.     thing    player    local
  21.     thing    indy
  22.     
  23.     #    ACTOR MOVE TARGETS
  24.     thing    in_mv0
  25.     
  26.     #    CAMERAS
  27.     thing    camPos
  28.     thing    insideCam
  29.  
  30.     #    CAMERA TARGETS
  31.     thing    MoveCamTarg        local
  32.     thing    MoveCamTarg1    local
  33.     thing    doortargpos
  34.     thing    beasttargpos
  35.  
  36.     #        PROPS
  37.     thing        door0        linkid=1
  38.     thing        door1        linkid=1        
  39.     thing        button0                
  40.     thing        button1                
  41.     
  42.     #        VARS
  43.     float        doorspeed=2.0    local
  44.     float        sleepTime=4.0    local
  45.     int            open=0            local
  46.     int            playerpos=0        local
  47.     int            whichline=0        local
  48.     int            firsttime=0        local
  49.     int            snd                local
  50.     int            track            local
  51.  
  52.     #        SOUNDS
  53.     sound    click=sol_panel_switch_c.wav    local
  54.     sound    open_squeak=sea_doors_open_c.wav    local
  55.     sound    close_squeak=sea_doors_close_c.wav    local
  56.     
  57.     sound    in_lockedline1=INXJ092.WAV    local
  58.     sound    in_lockedline2=INXJ096.WAV    local
  59.     sound    in_lockedline3=INXJ098.WAV    local
  60.     sound    in_scaredline=INXJ042.WAV    local
  61.     sound    beast=tem_warrior_roar_c.wav    local
  62.     sound    creepysong=mus_gen_eerie2.wav    local
  63.     
  64.     #    KEYFRAMES
  65.     keyframe    in_hat=0in_figithat_4_4.key        local
  66.     keyframe    in_brush=0in_stand1_bd_4.key        local
  67.     keyframe    in_stand4=0in_stand4.key        local
  68.     
  69.     #        SECTORS
  70.     sector    doorSector            local
  71.  
  72.     #    VECTORS
  73.     vector    CamTargPos    local
  74.     vector    CamTargPos1    local
  75.  
  76.     #    TEMPLATES
  77.     template    ghostTpl=ghost    local    
  78.             
  79. end
  80.  
  81. # ========================================================================================
  82.  
  83. code
  84.  
  85. startup:
  86.     
  87.     player = GetLocalPlayerThing();
  88.     doorSector = GetThingSector(door0);
  89.     SetSectorAdjoins(doorSector, 0);
  90.     return;
  91.  
  92. # ........................................................................................
  93.  
  94. # ........................................................................................
  95.  
  96. activated:
  97.  
  98.     if (open == 1) return;
  99.     if (IsThingMoving(door0)) return;    
  100.     
  101.     
  102.     
  103.     if (GetSenderRef() == button0)
  104.         {
  105.             
  106.             If (firsttime == 0)
  107.             {
  108.             call grandopening;
  109.             firsttime = 1;
  110.             return;
  111.             }
  112.             
  113.             SetActorFlags(player, 0x200000);
  114.             DeselectWeapon(player); # stow any weapon or lighter
  115.             Sleep(0.25); # wait a beat
  116.             open = 1;
  117.             SetSectorAdjoins(doorSector, 1);
  118.             PlayMode(player, 60, 0);
  119.             Sleep(0.5);
  120.             ClearActorFlags(player, 0x200000);
  121.             MoveToFrame(button0, 1, 1);
  122.             MoveToFrame(button1, 1, 1);
  123.             PlaySoundThing(click, button0, 1, 3, 10, 0x0);
  124.             Sleep(0.25);
  125.             Rotate(door0, -90, 1, doorspeed);
  126.             Rotate(door1, 90, 1, doorspeed);
  127.             PlaySoundThing(open_squeak, door0, 1, 3, 10, 0x0);
  128.             waitforstop(door0);
  129.             sleep(sleeptime);
  130.             Rotate(door0, 90, 1, doorspeed);
  131.             Rotate(door1, -90, 1, doorspeed);
  132.             PlaySoundThing(close_squeak, door0, 1, 3, 10, 0x0);
  133.             waitforstop(door0);
  134.             PlaySoundThing(click, door0, 1, 3, 10, 0x0);
  135.             MoveToFrame(button0, 0, 4);
  136.             MoveToFrame(button1, 0, 4);
  137.             SetSectorAdjoins(doorSector, 0);
  138.             open = 0;
  139.             return;
  140.         }
  141.  
  142.     if (GetSenderRef() == button1)
  143.         {
  144.             SetActorFlags(player, 0x200000);
  145.             DeselectWeapon(player); # stow any weapon or lighter
  146.             Sleep(0.25); # wait a beat
  147.             open = 1;
  148.             SetSectorAdjoins(doorSector, 1);
  149.             PlayMode(player, 60, 0);
  150.             Sleep(0.5);
  151.             ClearActorFlags(player, 0x200000);
  152.             MoveToFrame(button0, 1, 1);
  153.             MoveToFrame(button1, 1, 1);
  154.             PlaySoundThing(click, button1, 1, 3, 10, 0x0);
  155.             Sleep(0.25);
  156.             Rotate(door0, 90, 1, doorspeed);
  157.             Rotate(door1, -90, 1, doorspeed);
  158.             PlaySoundThing(open_squeak, door0, 1, 3, 10, 0x0);
  159.             waitforstop(door0);
  160.             sleep(sleeptime);
  161.             Rotate(door0, -90, 1, doorspeed);
  162.             Rotate(door1, 90, 1, doorspeed);
  163.             PlaySoundThing(close_squeak, door0, 1, 3, 10, 0x0);
  164.             waitforstop(door0);
  165.             PlaySoundThing(click, door0, 1, 3, 10, 0x0);
  166.             MoveToFrame(button0, 0, 4);
  167.             MoveToFrame(button1, 0, 4);
  168.             SetSectorAdjoins(doorSector, 0);
  169.             open = 0;
  170.             
  171.         }
  172.  
  173. If (GetSenderID() == 1)
  174.     {
  175.         open = 1;
  176.         whichline=RANDBETWEEN(1,3);
  177.         If (whichline == 1)
  178.         {
  179.             PlayVoice(player, in_lockedline1, 1, 0);
  180.         }
  181.  
  182.         If (whichline == 2)
  183.         {
  184.             PlayVoice(player, in_lockedline2, 1, 0);
  185.         }
  186.  
  187.         If (whichline == 3)
  188.         {
  189.             PlayVoice(player, in_lockedline3, 1, 0);
  190.         }
  191.  
  192.         PlayMode(player, 60, 1);
  193.         open = 0;
  194.     }
  195.     return;
  196.         
  197. # ........................................................................................
  198.  
  199. blocked:
  200.     print("wtf?");
  201.     return;
  202.  
  203. # ........................................................................................
  204. grandopening:
  205.  
  206. curCam = GetCurrentCamera();
  207. StartCutScene(1);
  208. #open = 1;
  209. SetCameraLookInterp(2, 0);
  210. SetCameraPosInterp(2, 0);
  211. DeselectWeapon(player); # stow any weapon or lighter
  212. Sleep(0.25); # wait a beat
  213. CopyPlayerHolsters(player, indy); # make sure actor has matching props
  214. SetThingFlags(player, 0x80000);
  215. ClearThingFlags(indy, 0x80000);
  216.  
  217. # Line Indy up...
  218. CopyOrientAndPos(player, indy);
  219. AISetLookThingEyeLevel(indy, button0);
  220. AIWaitForStop(indy);
  221.  
  222. # Slew follow camera to observe the scene from a known position
  223. SetExtCamOffsetToThing(camPos);
  224.  
  225. # setup a ghost object target
  226. CamTargPos = VectorAdd(VectorTransformToOrient(indy, '0.0 0.0 0.05'), GetThingPos(indy));
  227. MoveCamTarg = CreateThingAtPos(ghostTpl, GetThingSector(indy), CamTargPos, '0 0 0');
  228. CaptureThing(MoveCamTarg);
  229.  
  230.  
  231. # offset camera look target to thing.
  232. SetExtCamLookOffsetToThing(MoveCamTarg);
  233.  
  234.  
  235. # open the door
  236. PlayMode(indy, 60, 0);
  237. Sleep(1.0);
  238. #MoveToFrame(button0, 1, 1);
  239. #MoveToFrame(button1, 1, 1);
  240. #PlaySoundThing(click, button0, 1, 3, 10, 0x0);
  241.  
  242. # go to camera 2
  243. SetCameraFocus(2, camPos);
  244. SetCameraSecondaryFocus(2, MoveCamTarg);
  245. SetCurrentCamera(2);
  246. SetCameraFOV(90, 0, 0);
  247.  
  248. # set sector adjoins to draw 
  249. SetSectorAdjoins(doorSector, 1);
  250. # open the doors
  251. #Rotate(door0, -90, 1, doorspeed);
  252. #Rotate(door1, 90, 1, doorspeed);
  253.  
  254. # eerie music cue as door opens
  255. PlaySoundLocal(creepysong, 1.0, 0.0, 0x0, 0);
  256. #PlaySoundThing(open_squeak, door0, 1, 3, 10, 0x0);
  257.  
  258. # move camera focus object up to door
  259. animId = MoveThingToPos(MoveCamTarg, GetThingPos(doortargpos), 3.0);
  260. # indy actor looks as door opens
  261. AISetLookThingEyeLevel(indy, in_mv0);
  262. Sleep(1.0);
  263.  
  264. # indy actor moves into the room
  265. AISetMoveSpeed(indy, 1.5);
  266. AISetMoveThing(indy, doortargpos, 0);
  267. Sleep(2.0);
  268. AISetMoveThing(indy, in_mv0, 0);
  269.  
  270. # setup a ghost object target 1 METER ABOVE THE IN_MV0
  271. CamTargPos1 = VectorAdd(VectorTransformToOrient(indy, '0.0 0.0 0.05'), GetThingPos(indy));
  272. MoveCamTarg1 = CreateThingAtPos(ghostTpl, GetThingSector(indy), CamTargPos1, '0 0 0');
  273. CaptureThing(MoveCamTarg1);
  274. # attach MoveCamTarg1 to indy at 1 meter Z offset
  275. AttachThingToThing(MoveCamTarg1, indy);
  276.  
  277. # switch to inside camera focus on indy
  278. SetCameraFocus(2, insideCam);
  279. SetCameraSecondaryFocus(2, MoveCamTarg1);
  280. MovetoFrame(insideCam, 1, 1.0);
  281.  
  282. Sleep(4.0);
  283.  
  284. # play indy's anims and voice line
  285. track = PlayKey(indy, in_Stand4, 2, 0x0, 0);
  286. PlayKey(indy, in_brush, 4, 0x12, 1);
  287. snd = PlayVoice(indy, in_scaredline, 1.0, 0);
  288. PlayKey(indy, in_hat, 4, 0x12, 0);
  289.  
  290. # detach the camtarget and move it to the beasttarget
  291. DetachThing(MoveCamTarg1);
  292. Sleep(1.0);
  293. # move the moveable    camera target to beasttargetpos
  294. animId = MoveThingToPos(MoveCamTarg1, GetThingPos(beasttargpos), 4.0);
  295. Sleep(1.0);
  296.  
  297. # the beast screams
  298. PlaySoundLocal(beast, 1.0, 0.0, 0x0, 0);
  299.  
  300. Sleep(2.0);
  301.  
  302. # close the doors
  303. Sleep(0.5);
  304. #Rotate(door0, 90, 1, doorspeed);
  305. #Rotate(door1, -90, 1, doorspeed);
  306. #PlaySoundThing(close_squeak, door0, 1, 3, 10, 0x0);
  307. #waitforstop(door0);
  308. #PlaySoundThing(click, door0, 1, 3, 10, 0x0);
  309. #MoveToFrame(button0, 0, 4);
  310. #MoveToFrame(button1, 0, 4);
  311. #SetSectorAdjoins(doorSector, 0);
  312. #open = 0;
  313.  
  314. # restore player to indy's position
  315. CopyOrientAndPos(indy, player);
  316. SetThingFlags(indy, 0x80000);
  317. ClearThingFlags(player, 0x80000);
  318. SetCameraLookInterp(2, 0);
  319. SetcameraPosition(1, GetThingPos(insideCam));
  320. SetCurrentCamera(1);
  321. RestoreExtCam();
  322. EndCutScene();
  323. return;
  324.  
  325.  
  326. end
  327.  
  328.